﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using Controller;

namespace GUI
{
    /// <summary>
    /// Interaction logic for OpretMesse.xaml
    /// </summary>
    public partial class OpretMesseVindue : Window
    {
        MainController MesseController;

        public OpretMesseVindue(MainController messeController)
        {
            InitializeComponent();
            MesseController = messeController;
            
            btn_annuller.IsEnabled = true;
            txt_messeNavn.Focus();
        }

        private void btn_OpretMesse_Click(object sender, RoutedEventArgs e)
        {
            string dato;
            
            try
            {

                dato = dP_messeDato.SelectedDate.Value.Date.ToShortDateString();
                MesseController.OpretMesse(txt_messeNavn.Text, txt_messeSted.Text, dato);
                this.Close();
            }
            catch
            {
                MessageBox.Show("Udfyld venligst alle felter");
            }

        }

        private void btn_anuller_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {

        }
    }
}
